package testservice;

import com.common.core.WyyMusicConstant;
import com.domain.bean.music.MusicComment;
import com.domain.bean.music.Song;
import com.pachong.service.MusicCommentService;
import com.pachong.service.MusicService;
import com.pachong.service.SongService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author : wangyu
 * Date: 2018-03-05
 * Time: 14:29
 */
public class SongServiceTest extends BaseTest {

    @Autowired
    private SongService songService;

    @Resource
    private MusicCommentService musicCommentService;

    @Resource
    private MusicService musicService;

    @Test
    public void test3(){

        List<Song> songs = songService.selectSong(1);
        for(Song song:songs){
            musicService.handleAllComment(song.getCode(),0, WyyMusicConstant.SONG);
               song.setTimes(song.getTimes()+1);
            songService.saveAndFlush(song);
        }
    }

    @Test
    public void test1(){
        musicService.handleAllComment("887582185",0,WyyMusicConstant.SONG_MENU);
    }


    @Test
    public void test2(){
        MusicComment musicComment = new MusicComment();
        musicComment.setCommentId("ccc");
        musicCommentService.save(musicComment);

        MusicComment musicComment1 = new MusicComment();
        musicComment1.setCommentId("ddd");

        musicCommentService.save(musicComment1);

        MusicComment musicComment3 = new MusicComment();
        musicComment3.setCommentId("eee");
        musicCommentService.save(musicComment3);
    }

}
